#include <Chance.h>
#define ZERO  0.0000000000001f

Chance::Chance(float chance):chance_m(chance)
{

}


Chance Chance::operator!() const
{
   return Chance(1-chance_m);
}

Chance Chance::operator && (const Chance & chance)
{
   return Chance(chance_m*chance.chance_m);
}
Chance Chance::operator ||(const Chance & chance)
{
   return Chance(chance_m + chance.chance_m);
}

bool Chance::operator == (const Chance &chance)const
{

   return ( chance_m - chance.chance_m) <= ZERO;

}

bool Chance::operator != (const Chance &chance)const
{
   return !(*this == chance);
}
